The present invention relates to a data storage apparatus storing data, more specifically to an apparatus which writes/reads data to/from data recording medium such as a magnetic disk according to write/read commands received over a network from a plurality of computers or peripheral devices connected to the network.
A hard disk device and other data recording devices as data storage devices used for reading/writing information to/from a data recording medium are typically connected to a computer or other terminal device, and read/write information by executing commands received from the computer. Recording to or reading from the hard disk device is performed by communicating commands with data. The commands comprise a write or read instruction, the position from which the read/write operation begins (the address), and data size to read or write. They instruct the disk drive what to do. Each command also has a command identifier (such as an ID number) for identifying the command.
When a write command is issued, the hard disk device receives the information to be written (write data), and performs a write operation for writing information with the specified data size to the recording medium from the specified start address. When a read command is issued, the hard disk device reads data with the specified data size from the specified start address, and sends the read data to the computer. A plurality of commands each having an identifier can be received before processing a previously received command is completed. This is because the same number assigned to a command is assigned to the data associated with that command. As a result, commands and data will not be confused.
Write and read operations to a hard disk (recording medium) are referred to as disk xe2x80x9caccessxe2x80x9d operations. Both sequential access and random access operations are possible.
In the sequential access, the addresses of successive access operations are in substantially consecutive sequence such that the end of a first accessed data block and the start of the next accessed data block are consecutive. Movement of a recording head of the device from the end of the first access block to the start of the next access address is small, that is the time required for the head to move from the end address to the start address (the seek time) is short. Therefore, the amount of data that can be read or written in a predetermined period (the data throughput or transfer volume) is great.
With the random access, however, there is no relationship between addresses of consecutive access operations, and the recording head may need to move a great distance. The seek time in random access operations is therefore on average longer than that in sequential access operations, and data throughput per unit time is therefore less.
Hard disk devices can also be connected to a network and accessed from a plurality of computers. This type of hard disk device system is known as xe2x80x9ca data serverxe2x80x9d. When a plurality of users separately access information on a single magnetic disk device (data server), the disk is accessed by a random access operation, and data throughput therefore drops.
This type of data server is increasingly used for storing and retrieving audio-video (AV) data. While computer data can be read out and correctly reproduced even when there are delays in data access, that is, data reproduction is not time dependent, natural reproduction of audio and video information requires a specific (large) amount of data to be read within a specific limited amount of time. AV information is thus time-dependent. As a result, when AV data is randomly stored and read from multiple computers, data transfer may not proceed smoothly.
With consideration for the above mentioned problems, it is therefore an object of the present invention to improve the efficiency of data reading and writing in a data storage apparatus having a magnetic disk or other internal recording medium from/to which it reads/writes information.
In one aspect of the invention, a data storage apparatus for storing data to a data recording medium is provided. The apparatus receives commands through a communication device from external devices, records to the data recording medium data received with a command when the received command is a write command, and when the received command is a read command, reads information from the data recording medium according to the read command and outputs the data through the communication device.
The apparatus comprises a command storing device and a command executing device. The command storing device groups received commands according to a recording area on the data recording medium accessed by each command, and stores the received commands to a predetermined command group area according to the group. The command executing device selects, at a predetermined time interval, one of the command group areas in the command storing device, and executes at least one of commands stored in the selected command group area. The data recording medium may be a magnetic disk.
In the apparatus, the command executing device may select the command group area storing the most number of unexecuted commands, as the one selected command group area at a specific time interval. The command executing device may also select one of the command group areas in the command storing device in the predetermined sequence.
The command executing device may comprise a detection device and a command predicting device. The detection device detects whether data specified by a plurality of read commands is stored to sequential recording areas on the data recording medium when commands stored to the selected command group area are read commands. The command predicting device predicts a command for reading out data from a data recording area on the data recording medium when the detection device determines that sequential recording areas are accessed by the read commands, where the data recording area being sequential to areas accessed by commands stored in the selected command group area. Then the predicted command is processed consecutively to commands contained in the selected command group area.
In a second aspect of the invention, a method is provided for controlling a data storage apparatus for storing data to a data recording medium. The apparatus receives commands through a communication device from external devices, and records to the data recording medium data received with a command when the received command is a write command, and when the received command is a read command, reads information from the data recording medium according to the read command and outputs the data through the communication device.
The method comprises the steps of grouping received commands according to a recording area on the data recording medium accessed by each command; storing the received commands to a predetermined command group area according to the group; selecting at a predetermined time interval one of the command group areas; and executing at least one of commands stored in said selected command group area.
An apparatus according to the present invention processes received commands not in the order received, but in groups of commands grouped by the area on the data storage medium accessed by each command. Access to the recording area of the recording medium by a plurality of commands within a predetermined time period is therefore restricted to a limited area of the disk. Read/write head movement when accessing the data recording area is therefore reduced, and the amount of data read or written to disk within a specific unit of time can therefore be increased.
In addition, when data stored to sequential addresses in the recording area of the data recording medium is accessed, access commands that have still not been received can be predicted from the address contiguity of received commands and processed before the actual command is received. As a result, head travel can be further reduced, and data throughput can be further improved.